package org.fhm.zdte.common.standard;

/**
 * The interface <b>IJsonConvertor</b>'s implementation is used to convert between strings and objects.
 *
 * @author 谭波
 * @since 2024/2/2
 */
public interface IJsonConvertor {

    /**
     * Convert an object to strings.
     *
     * @param obj object.
     * @return strings.
     */
    String toJson(Object obj);

    /**
     * Convert string to objects.
     *
     * @param jsonStr Strings.
     * @param clazz   The class object of objects.
     * @param <T>     The class of objects.
     * @return objects.
     */
    <T> T fromJson(String jsonStr, Class<T> clazz);

}
